
clear, clc

UC = zeros(10,24);
Pgen = zeros(10,24);
unit_cost = zeros();
fuel_cost = zeros ();
Pmax=[ 455 455 130 130 162 , 80  85  55  55  55 ];
Pmin=[ 150 150  20  20  25 , 20  25  10  10  10 ];
Demand=[  700  750  850  950 1000 1100, 1150 1200 1300 1400 1450 1500 ....
         1400 1300 1200 1050 1000 1100, 1200 1400 1300 1100  900  800 ];


% generate initial populations (at least 4 pop)


% generate on-of configuration

hour = 24;

On = zeros (1,hour);

for H=1:hour
    for G=1:10
        UC(G,H)=( rand()<0.5 );
    end
end

% generate real power
% choose 4 condition

% example : if( UC(U,H,P)==1 ) && ( UC(U,H+1,P)==0 )

for H=1:hour
    for G=1:10
        if UC(G,H)==1
            Pgen(G,H) = round( ( Pmax(G)-Pmin(G) )*rand + Pmin(G)  ) ;
        else
            Pgen(G,H) = 0;
        end
    end
end


% cost calculation



    for H=1:hour
        for G=1:10
            if UC(G,H)==1
                unit_cost(G,H) = a(G) + b(G)* Pgen(G,H) + c(U)*Pgen(G,H)^2;
            else
                unit_cost(G,H) = 0 ;
            end
        end
        fuel_cost(1,H) = sum( unit_cost(:,H) );
    end

    
    
    
    
